package com.xzakota.minesweeper.msg;

import com.xzakota.minesweeper.model.entity.RoomBean;

import java.util.HashMap;
import java.util.Map;

/**
 * 游戏所有房间消息
 *
 * @author Xzakota
 */
public class GameAllRoomMsg extends BaseMsg {
    @SuppressWarnings("unchecked")
    public Map<Integer, RoomBean> getAllRoom() {
        Map<Integer, RoomBean> data = (Map<Integer, RoomBean>) this.data;
        return new HashMap<>(data);
    }

    @Override
    public String getTag() {
        return "游戏房间消息";
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder(getTag() + ": ");
        if (code == MsgCode.BASE_UNKNOWN) {
            sb.append("查询房间");
        } else {
            sb.append(getAllRoom());
        }

        return sb.toString();
    }
}
